<template>
  <div class="havebuy">
    <div class="head">
      <router-link tag="span" to="/user">
        <img src="../assets/img/fhui.png" alt=""
      /></router-link>
      <h1>已购买</h1>
      <div></div>
    </div>
    <div class="upcontent" v-show="list == null">
      <p>暂无订单</p>
    </div>
    <div class="content">
      <div class="box" v-for="(item, index) in list" :key="index">
        <div class="box_title">
          <h4>锤子商城</h4>
          <h6 v-show="item.list.buycheck">已支付</h6>
          <h6 v-show="!item.list.buycheck">未支付</h6>
        </div>
        <div class="box_content">
          <div class="left">
            <div class="img">
              <img :src="item.list.url" alt="" />
            </div>
          </div>
          <div class="middle">
            <p>{{ item.list.name }}</p>
            <h4>{{ item.list.Description }}</h4>
          </div>
          <div class="right">
            <p>&yen;{{Number(item.list.num)*Number(item.list.price)}}</p>
            <h6>共{{ item.list.num }}件</h6>
          </div>
        </div>
        <div class="box_buttom">
          <router-link tag="p" to="./isreceive" v-show="!item.list.isreceive"
            >去收货</router-link
          >
          <p v-show="item.list.isreceive">已收货</p>
          <router-link tag="p" to="./isEvaluation" v-show="item.list.isreceive"
            >去评价</router-link
          >
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ["updatalist"],
  data() {
    return {
      list: null,
      num:null,
    };
  },
  methods: {},
  created() {
    if (this.updatalist) {
      //全部订单
      this.list = this.updatalist.filter((item) => {
        return (item.list.isEvaluation == false || item.list.isreceive == false)
      });
      if (this.list.length == 0) {
        this.list = null;
      }
    //   this.list.forEach(item => {
    //      this.num=Number(item.list.price)*Number(item.list.num)
    //   });
    }
  },
//   computed: {
//     num() {
//       return this.list.reduce(function (total,item) {
//         return total= Number(item.list.price) * Number(item.list.num);
//       }, 0);
//     },
//   },
};
</script>

<style lang="scss" scoped>
.havebuy {
  .head {
    width: 100%;
    height: 50px;
    position: fixed;
    top: 0px;
    background-color: #fff;
    z-index: 50;
    border-bottom: 1px solid #dbdbdb;
    display: flex;
    justify-content: space-between;

    span {
      display: block;
      width: 30px;
      height: 30px;
      margin: 15px 0px;
      padding-left: 20px;

      img {
        width: 20px;
      }
    }
    div {
      width: 12%;
    }
    h1 {
      text-align: center;
      line-height: 50px;
      color: rgba(0, 0, 0, 0.6);
      font-size: 18px;
      font-weight: 700;
    }
  }
  .upcontent {
    width: 100%;
    margin-top: 50px;
    height: 635px;
    background-color: #f2f2f2;
    p {
      padding-top: 250px;
      text-align: center;
      font-size: 30px;
      color: gray;
    }
  }
  .content {
    background-color: #f2f2f2;
    // height: 700px;
    min-height: 700px;
    overflow: hidden;
    .box {
      // margin-top: 70px;
      background-color: #fff;
      border-radius: 5px;
      //   height: 60px;
      width: 90%;
      margin: 0 auto;
      margin-top: 70px;
      .box_title {
        display: flex;
        justify-content: space-between;
        padding: 5px 10px;
        height: 20px;
        h4 {
          line-height: 20px;
          font-weight: 600;
        }
        h6 {
          line-height: 20px;
          color: red;
        }
      }
      .box_content {
        display: flex;
        margin-top: 10px;
        padding-bottom: 30px;
        padding-top: 10px;
        width: 90%;
        margin: 0 auto;
        .left {
          width: 20%;
          .img {
            width: 50px;
            height: 50px;
            img {
              width: 50px;
            }
          }
        }
        .middle {
          flex: 1;
          display: flex;
          flex-direction: column;
          justify-content: center;
          width: 50%;
          padding-right: 5px;
          p {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }
          h4 {
            font-size: 10px;
            color: gray;
          }
        }
        .right {
          display: flex;
          flex-direction: column;
          justify-content: center;
          // width: 20%;
        }
      }
      .box_buttom {
        display: flex;
        margin-top: 10px;
        justify-content: flex-end;
        padding: 5px 0px;
        width: 90%;
        margin: 0 auto;
        p {
          font-size: 10px;
          padding: 5px 10px;
          border-radius: 5px;
          border: 1px solid gray;
        }
      }
    }
  }
}
</style> 